#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

typedef long long ll;
const int N = 25;
int a[N][N],t[N];

int calc(int x)
{
	int s = 0;
	while (x)
	{
		s++;
		x -= x & -x;
	}
	return s;
}

bool cmp(int x1, int x2)
{
	return x1 > x2;
}

int main()
{
	int n, m, k; cin >> n >> m >> k;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> a[i][j];
		}
	}
	 ll Max = -0x3f3f3f3f;
	for (int st = 0; st < (1 << n); st++)
	{
		ll sum = 0;
		memset(t, 0, sizeof(t));
		if (calc(st) > k)
			continue;

		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
			{
				if ((st>>i)&1)sum += a[i][j];
				else t[j] += a[i][j];
			}
		}

		sort(t, t + m, cmp);
		for (int i = 0; i < (k - calc(st)); i++)
		{
			sum += t[i];
		}
		Max = max(sum, Max);
	}
	cout << Max;

	return 0;
}
